<?php
App::uses('Riportsor', 'Model');

class RiportsorTest extends CakeTestCase {

	public $fixtures = array('app.riportsor','app.riport');

	public function setUp() {
		parent::setUp();
		$this->Riportsor = ClassRegistry::init('Riportsor');
	}

	public function tearDown() {
		unset($this->Riportsor);
		parent::tearDown();
	}

	public function testGetSorokFor() {
		$actual = $this->Riportsor->getSorokFor(1);
		$expected = 's:52:"{"szamlaTartomany" : "91*", "elojelforditas" : true}";';
		$this->assertEquals($expected, $actual[0]['Riportsor']['params']);
		
		$actual = $this->Riportsor->getSorokFor(100);
		$expected = false;
		$this->assertEquals($expected, $actual);
	}
	
	public function testGetSorId(){
		$actual = $this->Riportsor->getSorId(4, 1);
		$expected = 4;
		$this->assertEquals($expected, $actual);

		$actual = $this->Riportsor->getSorId(500, 1);
		$expected = false;
		$this->assertEquals($expected, $actual);

		$actual = $this->Riportsor->getSorId('', 1);
		$expected = false;
		$this->assertEquals($expected, $actual);

		$actual = $this->Riportsor->getSorId('JayaRadhe', 1);
		$expected = false;
		$this->assertEquals($expected, $actual);
	}
}
